<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/6/10
  Time: 21:33
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <title>黄山学院-留学生信息管理系统</title>
    <link rel="stylesheet" href="/css/main_style.css" />
    <link rel="stylesheet" href="/css/scholarship.css"/>
    <script src="/js/main_function.js"></script>
    <script>
        function scholarshipCheck() {
            Ajax.post("/scholarship/checkYet", null, function (result) {
                let results = JSON.parse(result);
                if (results.code == "100") {
                    let data = results.data;
                    let i=0;
                    let show = "<table border='1px'>" +
                        "<tr><td>学号</td><td>申请奖学金类别</td><td>学习成绩</td><td style='width: 370px'>申请理由</td><td>证明材料（请下载后阅读）</td><td>审核意见</td><td>提交</td></tr>";
                    for (; data[i] != null; i++) {
                        let body = data[i].bonus_items_body;
                        let practice= data[i].bonus_items_practice;
                        let id = data[i].user_id;
                        show = show + "<tr>" +
                            "<td>" + id + "</td>" +
                            "<td>" + scholarship_type(data[i].scholarship_type) + "</td>" +
                            "<td>" +
                                "<p>学期必修课程数："+data[i].curriculum_number + "</p>"+
                                "<p>学分："+data[i].average_credit + "</p>"+
                                "<p>绩点："+data[i].gpa + "</p>"+
                            "</td>" +
                            "<td>" + data[i].reason + "</td>" +
                            "<td>" +
                                "<p>身心素质：<a href='/scholarship/check/" + id + "/" + body + "'> " + body + "</a></p>" +
                                "<p>实践创新：<a href='/scholarship/check/" + id + "/" + practice + "'> " + practice + "</a></p>" +
                            "</td>" +
                            "<td><textarea id='" + id + "' value='' style='width: 100%; height: 60px;border: 0px;outline:none;' placeholder='如果要驳回审核，可以在此处提醒学生申请上出现的问题'></textarea></td>" +
                            "<td>" +
                                "<button onclick='scholarshipDeal(\"" + id + "\",1)' style='width: 100%; height: 50%;'>审核通过</button>" +
                                "<button onclick='scholarshipDeal(\"" + id + "\",0)' style='width: 100%; height: 50%;'>审核驳回</button>" +
                            "</td>" +
                            "</tr>";
                    }
                    show = show + "</table>";
                    if(i!=0){
                        document.getElementById("scholarship").innerHTML = show;
                    }
                }
            })
        }
        function scholarshipDeal(user_id,is_yes) {
            let advice = document.getElementById(user_id).value;
            let sendData = '{' + "\"user_id\":\"" + user_id + "\",\"advice\":\"" + advice + "\",\"is_yes\":\""+is_yes+"\""+'}';
            Ajax.post("/scholarship/deal", sendData, function (result) {
                let results = JSON.parse(result);
                if (results.code == "100") {
                    document.location.href = "/teacher/scholarship";
                }
            })
        }
    </script>
    <style>
        table{
            width: 100%;
            border-top: 1px solid #999;
            border-left: 1px solid #999;
            border-spacing: 0;/*去掉单元格间隙*/
        }
    </style>
</head>
<body onload="scholarshipCheck()">
<div id="navigation">
    <div class="navigation-left"><img src="/img/school.png" style="width: 170px;height: 60px;"></img></div>
    <div class="navigation-center"><a>奖学金审核</a></div>
    <div class="navigation-right">
        <div class="drop-menu" style="float:right;">
            <div class="user-menu"></div>
            <div class="drop-menu-content">
                <a href="/logout">注销登录</a>
                <a href="/rePassword">修改密码</a>
            </div>
        </div>
    </div>
</div>
<div id="broadside">
    <div class="broadside-logo">
        <h1>欢迎教师</h1>
        <p>工号${user_id}</p>
    </div>
    <div class="broadside-menu">
        <p><img src="/img/home.png"/><a href="/teacher/home">首页</a></p>
        <p><img src="/img/manager.png"/><a href="/teacher/manager">学生信息管理</a></p>
        <p><img src="/img/vacation.png"/><a href="/teacher/vacation">事假管理</a></p>
        <p><img src="/img/scholarship.png"/><a href="/teacher/scholarship">奖学金审核</a></p>
        <p><img src="/img/message.png"/><a href="/teacher/message ">留言板</a></p>
    </div>
</div>
<div id="content">
    <div class="title"><p>当前所有未处理的奖学金申请</p></div>
    <div id="scholarship">无</div>
</div>
</body>
</html>
